eeprom17 2.2.2
Loading...
Searching...
No Matches
eeprom17.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2026 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
27
28#ifndef EEPROM17_H
29#define EEPROM17_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
52
58
63
68
73#define EEPROM17_MEM_PAGE_BITMASK 0xF0
74#define EEPROM17_MEM_PAGE_SIZE 16
75#define EEPROM17_MEM_BANK_SIZE 256
76
81#define EEPROM17_BANK_SEL_0 0x00
82#define EEPROM17_BANK_SEL_1 0x01
83
89#define EEPROM17_DEVICE_ADDRESS_0 0x50
90#define EEPROM17_DEVICE_ADDRESS_1 0x52
91 // eeprom17_set
93
98
103
108#define EEPROM17_MAP_MIKROBUS( cfg, mikrobus ) \
109 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
110 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
111 cfg.wc = MIKROBUS( mikrobus, MIKROBUS_PWM );
112 // eeprom17_map // eeprom17
115
120typedef struct
121{
122 // Output pins
123 digital_out_t wc;
124
125 // Modules
126 i2c_master_t i2c;
127
128 // I2C slave address
130
131} eeprom17_t;
132
137typedef struct
138{
139 pin_name_t scl;
140 pin_name_t sda;
141
142 pin_name_t wc;
143
144 uint32_t i2c_speed;
145 uint8_t i2c_address;
146
148
153typedef enum
154{
157
159
165
176
191
204err_t eeprom17_write_memory ( eeprom17_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len );
205
218err_t eeprom17_read_memory ( eeprom17_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len );
219
228void eeprom17_set_wc_pin ( eeprom17_t *ctx, uint8_t state );
229
240err_t eeprom17_select_bank ( eeprom17_t *ctx, uint8_t bank_sel );
241
242#ifdef __cplusplus
243}
244#endif
245#endif // EEPROM17_H
246 // eeprom17
248
249// ------------------------------------------------------------------------ END
eeprom17_return_value_t
EEPROM 17 Click return value data.
Definition eeprom17.h:154
@ EEPROM17_OK
Definition eeprom17.h:155
@ EEPROM17_ERROR
Definition eeprom17.h:156
err_t eeprom17_write_memory(eeprom17_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len)
EEPROM 17 Write Memory function.
void eeprom17_set_wc_pin(eeprom17_t *ctx, uint8_t state)
EEPROM 17 Set Write Control Pin function.
err_t eeprom17_init(eeprom17_t *ctx, eeprom17_cfg_t *cfg)
EEPROM 17 initialization function.
err_t eeprom17_select_bank(eeprom17_t *ctx, uint8_t bank_sel)
EEPROM 17 Select Memory Bank function.
err_t eeprom17_read_memory(eeprom17_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len)
EEPROM 17 Read Memory function.
void eeprom17_cfg_setup(eeprom17_cfg_t *cfg)
EEPROM 17 configuration object setup function.
EEPROM 17 Click configuration object.
Definition eeprom17.h:138
uint32_t i2c_speed
Definition eeprom17.h:144
pin_name_t wc
Definition eeprom17.h:142
pin_name_t scl
Definition eeprom17.h:139
pin_name_t sda
Definition eeprom17.h:140
uint8_t i2c_address
Definition eeprom17.h:145
EEPROM 17 Click context object.
Definition eeprom17.h:121
digital_out_t wc
Definition eeprom17.h:123
i2c_master_t i2c
Definition eeprom17.h:126
uint8_t slave_address
Definition eeprom17.h:129